package com.uikoo9.manage.y.model;

import java.util.List;

import com.jfinal.plugin.activerecord.Model;
import com.uikoo9.util.core.annotation.QTable;
import com.uikoo9.util.core.data.QStringUtil;

/**
 * YRelaModel<br>
 * id	id<br>
 * y_rela_srctable	源表<br>
 * y_rela_srcid	源id<br>
 * y_rela_relatable	关联表<br>
 * y_rela_relaid	关联id<br>
 * y_rela_type	类型<br>
 * cdate	创建时间<br>
 * cuser_id	input_id<br>
 * cuser_name	input_name<br>
 * @author qiaowenbin
 */
@QTable("t_y_rela")
@SuppressWarnings("serial")
public class YRelaModel extends Model<YRelaModel>{
	
	public static final YRelaModel dao = new YRelaModel();
	
	/**
	 * find all
	 * @return
	 */
	public List<YRelaModel> findAll(){
		return findAll(null);
	}
	
	/**
	 * find all by order
	 * @param order
	 * @return
	 */
	public List<YRelaModel> findAll(String order){
		StringBuilder sb = new StringBuilder("select * from t_y_rela ");
		if(QStringUtil.isEmpty(order)){
			return dao.find(sb.append("order by id desc").toString());
		}else{
			return dao.find(sb.append(order).toString());
		}
	}
	
}
